#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    int numTilings(int n) {
        if (n == 1)
            return 1;
        using LL = long long;
        const int MOD = 1e9 + 7, N = 1000;
        vector<LL> dp(N + 1, 0);
        dp[0] = dp[1] = 1;
        dp[2] = 2;
        for (int i = 3; i <= n; i++)
        {
            dp[i] = dp[i - 1] * 2 + dp[i - 3];
            dp[i] %= MOD;
        }
        return dp[n];
    }
};